import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'

import dataV from '@jiaminghi/data-view'
// 导入axios
import axios from 'axios'

import '@/assets/css/utils.less'
// import '@/assets/css/iconfont/iconfont.css'

import cancel from '@/components/utils/cancel.vue'

Vue.component('cancel', cancel)

Vue.use(ElementUI)
Vue.use(dataV)

axios.defaults.baseURL = `http://${window.location.href.split('/')[2].split(':')[0]}/smartlab/index.php/iot/`
Vue.prototype.$http = axios

Vue.config.productionTip = false

import api from '@/request/api/index.js'
Vue.prototype.$api = api // 挂载请求

import utils from '@/utils/utilJS/index.js'
Vue.prototype.$utils = utils

import loading from '@/components/utils/loading/index.vue'
Vue.component('loading', loading)

Vue.prototype.$echarts = window.echarts

Vue.prototype.$eventBus = new Vue()

Vue.mixin({
  data() {
    return {
       mqtt: null
    }
  },
  computed: {
    client_mixin() {
      return this.$store.state.client
    },
    mqtt_mixin() {
      return this.$store.state.mqttStatus
    }
  },
  beforeDestroy() {

  },
})

var vm = new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')

export default vm
